#ifndef RING_BUFFER_H
#define RING_BUFFER_H

#include <stdint.h>
#include <stdbool.h>

typedef struct {
    uint8_t *buffer;
    int size;
    int head;
    int tail;
    int count;
} RingBuffer;

void ring_init(RingBuffer *rb, uint8_t *buf, int size);
bool ring_push(RingBuffer *rb, uint8_t data);
bool ring_pop(RingBuffer *rb, uint8_t *data);
int ring_available(RingBuffer *rb);

#endif // RING_BUFFER_H